package com.chixing.util;

public class Result {
    private int code;
    private String reason;
    private Object data;

    public Result(){}
    public Result(int code, String reason, Object data) {
        this.code = code;
        this.reason = reason;
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public  static Result success(String reason, Object data){
        return new Result(200,reason,data);
    }
    public  static Result fail( String reason, Object data){
        return new Result(201,reason,data);
    }

    @Override
    public String toString() {
        return "ServerResponse{" +
                "code=" + code +
                ", reason='" + reason + '\'' +
                ", data=" + data +
                '}';
    }
}
